<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - ohos_codeCoverage.info - base/account/os_account/frameworks/common/log/include/account_log_wrapper.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../../../../index.html">top level</a> - <a href="index.html">base/account/os_account/frameworks/common/log/include</a> - account_log_wrapper.h<span style="font-size: 80%;"> (source / <a href="account_log_wrapper.h.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">ohos_codeCoverage.info</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2022-08-23 10:37:51</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">1</td>
            <td class="headerCovTableEntry">1</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td></td>
            <td></td>
            <td></td>
            <td class="headerItem">Branches:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntryHi">-</td>
          </tr>
          <tr><td><img src="../../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">           Branch data     Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>                :            : /*</a>
<a name="2"><span class="lineNum">       2 </span>                :            :  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.</a>
<a name="3"><span class="lineNum">       3 </span>                :            :  * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</a>
<a name="4"><span class="lineNum">       4 </span>                :            :  * you may not use this file except in compliance with the License.</a>
<a name="5"><span class="lineNum">       5 </span>                :            :  * You may obtain a copy of the License at</a>
<a name="6"><span class="lineNum">       6 </span>                :            :  *</a>
<a name="7"><span class="lineNum">       7 </span>                :            :  *     http://www.apache.org/licenses/LICENSE-2.0</a>
<a name="8"><span class="lineNum">       8 </span>                :            :  *</a>
<a name="9"><span class="lineNum">       9 </span>                :            :  * Unless required by applicable law or agreed to in writing, software</a>
<a name="10"><span class="lineNum">      10 </span>                :            :  * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</a>
<a name="11"><span class="lineNum">      11 </span>                :            :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</a>
<a name="12"><span class="lineNum">      12 </span>                :            :  * See the License for the specific language governing permissions and</a>
<a name="13"><span class="lineNum">      13 </span>                :            :  * limitations under the License.</a>
<a name="14"><span class="lineNum">      14 </span>                :            :  */</a>
<a name="15"><span class="lineNum">      15 </span>                :            : </a>
<a name="16"><span class="lineNum">      16 </span>                :            : #ifndef OS_ACCOUNT_FRAMEWORKS_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H</a>
<a name="17"><span class="lineNum">      17 </span>                :            : #define OS_ACCOUNT_FRAMEWORKS_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H</a>
<a name="18"><span class="lineNum">      18 </span>                :            : </a>
<a name="19"><span class="lineNum">      19 </span>                :            : #include &lt;string&gt;</a>
<a name="20"><span class="lineNum">      20 </span>                :            : #include &quot;hilog/log.h&quot;</a>
<a name="21"><span class="lineNum">      21 </span>                :            : </a>
<a name="22"><span class="lineNum">      22 </span>                :            : namespace OHOS {</a>
<a name="23"><span class="lineNum">      23 </span>                :            : namespace AccountSA {</a>
<a name="24"><span class="lineNum">      24 </span>                :            : enum class AccountLogLevel { DEBUG = 0, INFO, WARN, ERROR, FATAL };</a>
<a name="25"><span class="lineNum">      25 </span>                :            : </a>
<a name="26"><span class="lineNum">      26 </span>                :            : static constexpr OHOS::HiviewDFX::HiLogLabel ACCOUNT_LABEL = {LOG_CORE, LOG_DOMAIN, ACCOUNT_LOG_TAG};</a>
<a name="27"><span class="lineNum">      27 </span>                :            : </a>
<a name="28"><span class="lineNum">      28 </span>                :            : class AccountLogWrapper {</a>
<a name="29"><span class="lineNum">      29 </span>                :            : public:</a>
<a name="30"><span class="lineNum">      30 </span>                :            :     static bool JudgeLevel(const AccountLogLevel &amp;level);</a>
<a name="31"><span class="lineNum">      31 </span>                :            : </a>
<a name="32"><span class="lineNum">      32 </span>                :            :     static void SetLogLevel(const AccountLogLevel &amp;level)</a>
<a name="33"><span class="lineNum">      33 </span>                :            :     {</a>
<a name="34"><span class="lineNum">      34 </span>                :            :         level_ = level;</a>
<a name="35"><span class="lineNum">      35 </span>                :            :     }</a>
<a name="36"><span class="lineNum">      36 </span>                :            : </a>
<a name="37"><span class="lineNum">      37 </span>                :<span class="lineCov">          1 :     static const AccountLogLevel &amp;GetLogLevel()</span></a>
<a name="38"><span class="lineNum">      38 </span>                :            :     {</a>
<a name="39"><span class="lineNum">      39 </span>                :<span class="lineCov">          1 :         return level_;</span></a>
<a name="40"><span class="lineNum">      40 </span>                :            :     }</a>
<a name="41"><span class="lineNum">      41 </span>                :            : </a>
<a name="42"><span class="lineNum">      42 </span>                :            :     static std::string GetBriefFileName(const std::string &amp;file);</a>
<a name="43"><span class="lineNum">      43 </span>                :            : </a>
<a name="44"><span class="lineNum">      44 </span>                :            : private:</a>
<a name="45"><span class="lineNum">      45 </span>                :            :     static AccountLogLevel level_;</a>
<a name="46"><span class="lineNum">      46 </span>                :            : };</a>
<a name="47"><span class="lineNum">      47 </span>                :            : </a>
<a name="48"><span class="lineNum">      48 </span>                :            : #define PRINT_LOG(LEVEL, Level, fmt, ...)                                   \</a>
<a name="49"><span class="lineNum">      49 </span>                :            :     if (AccountLogWrapper::JudgeLevel(AccountLogLevel::LEVEL))              \</a>
<a name="50"><span class="lineNum">      50 </span>                :            :     OHOS::HiviewDFX::HiLog::Level(ACCOUNT_LABEL,                            \</a>
<a name="51"><span class="lineNum">      51 </span>                :            :         &quot;[%{public}s(%{public}s:%{public}d)] &quot; fmt,                         \</a>
<a name="52"><span class="lineNum">      52 </span>                :            :         AccountLogWrapper::GetBriefFileName(std::string(__FILE__)).c_str(), \</a>
<a name="53"><span class="lineNum">      53 </span>                :            :         __FUNCTION__,                                                       \</a>
<a name="54"><span class="lineNum">      54 </span>                :            :         __LINE__,                                                           \</a>
<a name="55"><span class="lineNum">      55 </span>                :            :         ##__VA_ARGS__)</a>
<a name="56"><span class="lineNum">      56 </span>                :            : </a>
<a name="57"><span class="lineNum">      57 </span>                :            : #define ACCOUNT_LOGD(fmt, ...) PRINT_LOG(DEBUG, Debug, fmt, ##__VA_ARGS__)</a>
<a name="58"><span class="lineNum">      58 </span>                :            : #define ACCOUNT_LOGI(fmt, ...) PRINT_LOG(INFO, Info, fmt, ##__VA_ARGS__)</a>
<a name="59"><span class="lineNum">      59 </span>                :            : #define ACCOUNT_LOGW(fmt, ...) PRINT_LOG(WARN, Warn, fmt, ##__VA_ARGS__)</a>
<a name="60"><span class="lineNum">      60 </span>                :            : #define ACCOUNT_LOGE(fmt, ...) PRINT_LOG(ERROR, Error, fmt, ##__VA_ARGS__)</a>
<a name="61"><span class="lineNum">      61 </span>                :            : #define ACCOUNT_LOGF(fmt, ...) PRINT_LOG(FATAL, Fatal, fmt, ##__VA_ARGS__)</a>
<a name="62"><span class="lineNum">      62 </span>                :            : }  // namespace AccountSA</a>
<a name="63"><span class="lineNum">      63 </span>                :            : }  // namespace OHOS</a>
<a name="64"><span class="lineNum">      64 </span>                :            : </a>
<a name="65"><span class="lineNum">      65 </span>                :            : #endif  // OS_ACCOUNT_FRAMEWORKS_COMMON_LOG_INCLUDE_ACCOUNT_LOG_WRAPPER_H</a>
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
  </table>
  <br>

</body>
</html>
